<?php
$arrSortMark = Article::getSortMarkDay(5);
$arrSortComment = Article::getCommentMarkDay(5);
if ($userRole)
echo '
<ul class="right_botron">
	<li><a class="lesons" href="' . W_ABSPATH . 'newArticle/' . (isset($idFolder) ? $idFolder . '/' : NULL) . '">Добавить статью</a></li>
</ul>';

require_once(TEMPLATE . 'columns/banner.php');

if ($arrSortMark){
	echo '<h3>Лучшие статьи за сегодня</h3>';

	foreach ($arrSortMark as $arrSortMark){
		echo '
		<div class="news">
			<ul>
				<li>';
					if ($arrSortMark['essence_type'] == 11)
			      echo '<a href="' . W_ABSPATH . 'community/' . $arrSortMark['ID_essence'] . '/">' . $arrSortMark['folder_name'] . '</a>';
			    elseif ($arrSortMark['essence_type'] == 3)
			    	echo '<a href="' . W_ABSPATH . 'user/' . $arrSortMark['login'] . '/">Дневник ' . $arrSortMark['login'] . '</a>';
			    elseif ($arrSortMark['essence_type'] == 14)
			    	echo '<a href="' . W_ABSPATH . 'developerBlog' . '">Блог разработчиков</a>';
			    echo '
				</li>
				<li class="last">
					<a href="' . W_ABSPATH . 'article/' . $arrSortMark['ID_article'] . '">
						' . (strlen($arrSortMark['name']) > 25 ? Service_String::cutString($arrSortMark['name'], 25) : $arrSortMark['name']) . '
					</a>
				</li>
			</ul>
			<span class="right_news">' . round($arrSortMark['average_mark'], 2) . '</span>
		</div>';
	}
}


if ($arrSortComment){
	echo '
	<h3>Обсуждаемые статьи за сегодня</h3>';

	foreach ($arrSortComment as $arrSortComment){
		echo '
		<div class="news">
			<ul>
				<li>';
					if ($arrSortComment['essence_type'] == 11)
			      echo '<a href="' . W_ABSPATH . 'community/' . $arrSortComment['ID_essence'] . '/">' . $arrSortComment['folder_name'] . '</a>';
			    elseif ($arrSortComment['essence_type'] == 3)
			    	echo '<a href="' . W_ABSPATH . 'user/' . $arrSortComment['login'] . '/">Дневник ' . $arrSortComment['login'] . '</a>';
			    elseif ($arrSortComment['essence_type'] == 14)
			    	echo '<a href="' . W_ABSPATH . 'developerBlog' . '">Блог разработчиков</a>';
			    echo '
				</li>
				<li class="last">
					<a href="' . W_ABSPATH . 'article/' . $arrSortComment['ID_article'] . '">
						' . (strlen($arrSortComment['name']) > 25 ? Service_String::cutString($arrSortComment['name'], 25) : $arrSortComment['name']) . '
					</a>
				</li>
			</ul>
			<span class="right_news_read">' . $arrSortComment['comment_amount'] . '</span>
		</div>';
	}
}
?>